Autodesk Developer Network 2011
Autodesk
Geometry API
§Transformation
§GeometryElement.GetTransformed() - Return a copy of the geometry transformed
§Instance.GetTransform() – return the transform of the instance
§Instance.GetTotalTransform() – return the total transform (e.g., true north transform of an imported instance).
§Serialization/deserialization of Reference
§Reference.ConvertToStableRepresentation() - convert a reference to a stable string representation
§Reference.ParseFromStableRepresentation() – restore the serialized reference. Could be in the same or different Revit session
§
§
§
§
public string SerializeReference(Document doc, Reference reference)
{
String ids = String.Empty;
ids = reference.ConvertToStableRepresentation(doc);
TaskDialog.Show("SerializeReference", "Representation:\n" + ids);
return ids;
}

| GeometryElement.GetTransformed() returns a copy of the geometry in the original element, transformed by the input coordinate transformation. The GetTransform() and GetTotalTransformed() methods return the transform of the instance.
| We now have the ability to save a reference to a geometry object, say, a face, edge or curve as string and obtain identical reference later using the String as input in the same or different Revit session. So the ConvertToStableRepresentation() converts a reference to a stable string representation and ParseFromStableRepresentation restores the serialized reference.